libxl: disallow attaching the same device more than once
authorWei Liu <wei.liu2@citrix.com>
Thu, 4 Sep 2014 22:43:13 +0000 (23:43 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 9 Sep 2014 11:46:23 +0000 (12:46 +0100)
commit0d5d5eca4afa35332891112f5f25c2f2cba790a2
treed478de0ef45181467b2a9e5543a4362601b1f8d5
parent7e56e7855e13da418baa402669ba0800389127b7
libxl: disallow attaching the same device more than once

Originally the code allowed users to attach the same device more than
once. It just stupidly overwrites xenstore entries. This is bogus as
frontend will be very confused.

Introduce a helper function to check if the device to be written to
xenstore already exists. A new error code is also introduced.

The check and add are within one xs transaction.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_device.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_pci.c
tools/libxl/libxl_types.idl